<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="其它," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="前言我想成为一个优秀的程序员，然而在技术成长和人生成长的时候必然会有许多感悟，而这些感悟是让人走的更远的利器，而个人博客是记录这些感悟的的一个不错的选择。所以我想用博客来记录我成长的点点滴滴！！！ 搭建博客的准备我选择的是GithubPages + Hexo + Next,这一种简单高效的方式实现。主要记录Mac系统搭建个人博客的详解。 搭建博客工具在Mac系统下搭建的：  Xcode因为从事iO">
<meta name="keywords" content="其它">
<meta property="og:type" content="article">
<meta property="og:title" content="GithubPages+Hexo+Next搭建博客">
<meta property="og:url" content="https://github.com/xiaoqiang051512/xiaoqiang051512.github.io/2017/05/10/我的博客的起源/index.html">
<meta property="og:site_name" content="小强5号">
<meta property="og:description" content="前言我想成为一个优秀的程序员，然而在技术成长和人生成长的时候必然会有许多感悟，而这些感悟是让人走的更远的利器，而个人博客是记录这些感悟的的一个不错的选择。所以我想用博客来记录我成长的点点滴滴！！！ 搭建博客的准备我选择的是GithubPages + Hexo + Next,这一种简单高效的方式实现。主要记录Mac系统搭建个人博客的详解。 搭建博客工具在Mac系统下搭建的：  Xcode因为从事iO">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/2230763-9610f081c034f19c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://oor0l2hfq.bkt.clouddn.com/github.png">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/2230763-d98509ddf6de2bba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/2230763-e60a736d478b58af.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/2230763-668b6f20635b9273.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://oor0l2hfq.bkt.clouddn.com/0055fec2-7dfc-4a60-857d-38f4e1487055.png">
<meta property="og:image" content="http://oor0l2hfq.bkt.clouddn.com/787bc017-ca92-4f65-a753-4101d822b459.png">
<meta property="og:image" content="http://oor0l2hfq.bkt.clouddn.com/71c5686e-f623-4ac1-b9d5-4e153ca6b6b7.png">
<meta property="og:image" content="http://oor0l2hfq.bkt.clouddn.com/%E5%BD%95%E5%88%B6Gif1.gif">
<meta property="og:image" content="http://oor0l2hfq.bkt.clouddn.com/016cdcdb-e2dd-4e9e-98c4-ff60f4effed0.png">
<meta property="og:updated_time" content="2017-06-30T05:54:51.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="GithubPages+Hexo+Next搭建博客">
<meta name="twitter:description" content="前言我想成为一个优秀的程序员，然而在技术成长和人生成长的时候必然会有许多感悟，而这些感悟是让人走的更远的利器，而个人博客是记录这些感悟的的一个不错的选择。所以我想用博客来记录我成长的点点滴滴！！！ 搭建博客的准备我选择的是GithubPages + Hexo + Next,这一种简单高效的方式实现。主要记录Mac系统搭建个人博客的详解。 搭建博客工具在Mac系统下搭建的：  Xcode因为从事iO">
<meta name="twitter:image" content="http://upload-images.jianshu.io/upload_images/2230763-9610f081c034f19c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"right","display":"always","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://github.com/xiaoqiang051512/xiaoqiang051512.github.io/2017/05/10/我的博客的起源/"/>





  <title> GithubPages+Hexo+Next搭建博客 | 小强5号 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?de5f7eecb9707639a092d57bccd58ae8";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-right page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">小强5号</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-ios,生活杂谈,其它"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archives"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-oc,swift,生活,其它"></i> <br />
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocapitalize="off" autocomplete="off" autocorrect="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://github.com/xiaoqiang051512/xiaoqiang051512.github.io/2017/05/10/我的博客的起源/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="刘志伟">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="小强5号">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                GithubPages+Hexo+Next搭建博客
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-05-10T11:59:15+08:00">
                2017-05-10
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/other/" itemprop="url" rel="index">
                    <span itemprop="name">other</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body han-init-context" itemprop="articleBody">

      
      

      
        <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>我想成为一个优秀的程序员，然而在技术成长和人生成长的时候必然会有许多感悟，而这些感悟是让人走的更远的利器，而个人博客是记录这些感悟的的一个不错的选择。所以我想用博客来记录我成长的点点滴滴！！！</p>
<h2 id="搭建博客的准备"><a href="#搭建博客的准备" class="headerlink" title="搭建博客的准备"></a>搭建博客的准备</h2><p>我选择的是<a href="https://pages.github.com" target="_blank" rel="external">GithubPages</a> + <a href="https://hexo.io/zh-cn/" target="_blank" rel="external">Hexo</a> + <a href="http://theme-next.iissnan.com" target="_blank" rel="external">Next</a>,这一种简单高效的方式实现。主要记录Mac系统搭建个人博客的详解。</p>
<h3 id="搭建博客工具"><a href="#搭建博客工具" class="headerlink" title="搭建博客工具"></a>搭建博客工具</h3><p>在Mac系统下搭建的：</p>
<ul>
<li><p><strong>Xcode</strong><br>因为从事iOS开发的原因，Mac上已经安装了Xocde，然而Xocde集成了Git，所以就直接省略了下载Git的步骤，如果为Mac系统上未安装Xcode可以去 <strong><a href="https://git-scm.com/downloads" target="_blank" rel="external">Git官网</a></strong>下载</p>
</li>
<li><p><strong>Node.js</strong><br>上述步骤完成接下来是安装<strong><a href="https://nodejs.org/zh-cn/download/" target="_blank" rel="external">Node.js官网下载</a></strong>程序</p>
</li>
<li><p><strong>Hexo</strong><br>接下来主角登场，安装Hexo</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install hexo-cli -g</div></pre></td></tr></table></figure>
</li>
</ul>
<p>若出现安装命令不成功，出现如下错误<img src="http://upload-images.jianshu.io/upload_images/2230763-9610f081c034f19c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p>
<p>解决方法：可输入下面的命令和密码继续完成安装</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sudo npm install --unsafe-perm --verbose</div></pre></td></tr></table></figure>
<ul>
<li><strong>博客本地仓库</strong></li>
</ul>
<ol>
<li><strong>Github上创建分支</strong><br>按照下面方式在github创建github的仓库<br><img src="http://oor0l2hfq.bkt.clouddn.com/github.png" alt=""></li>
</ol>
<p>在你的本地创建一个博客文件夹，打开终端进入到你刚刚创建的目录下，在终端进入到该目录，然后执行Hexo命令，初始化本地博客仓库:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo init 你的Github用户名.github.io</div></pre></td></tr></table></figure></p>
<p>注意：这里初始化的时候一定要按上述格式创建，不然可能会初始化不成功，在这里踩过坑，所以记忆犹新。</p>
<ul>
<li><strong>博客初步完成</strong><br>上述步骤顺利完成后，自己的博客框架就已经基本搭建完成了，Hexo安装后默认使用的是landscape主题，终端进入到你博客的博客本地仓库中</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo s --debug</div></pre></td></tr></table></figure>
<p><img src="http://upload-images.jianshu.io/upload_images/2230763-d98509ddf6de2bba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p>
<p>博客的的预览地址就是上述图片中的 <a href="http://localhost:4000/." target="_blank" rel="external">http://localhost:4000/.</a><br>在浏览器输入上述地址，会惊喜的见到如下的模样，有木有很惊喜</p>
<p><img src="http://upload-images.jianshu.io/upload_images/2230763-e60a736d478b58af.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p>
<h3 id="Hexo的主题"><a href="#Hexo的主题" class="headerlink" title="Hexo的主题"></a>Hexo的主题</h3><p>在终端进入到博客本地仓库下，执行下面的命令，等待主题的下载完成</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git clone https://github.com/iissnan/hexo-theme-next themes/next</div></pre></td></tr></table></figure>
<p><img src="http://upload-images.jianshu.io/upload_images/2230763-668b6f20635b9273.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p>
<p><a href="https://hexo.io/zh-cn/docs/configuration.html" target="_blank" rel="external">Next主题</a>已经下载完成了，接下来是配置主题了，这里需要细心的一步一步的配置。</p>
<p><img src="http://oor0l2hfq.bkt.clouddn.com/0055fec2-7dfc-4a60-857d-38f4e1487055.png" alt="image"></p>
<p>上面这个这个是Hexo<strong>主站的配置文件</strong>,可以直接用用系统的文本编辑器进行编辑,注意编辑时需要与前面参数空一格，首先我们需要将博客地址制定到Github里面，如下图：<br><img src="http://oor0l2hfq.bkt.clouddn.com/787bc017-ca92-4f65-a753-4101d822b459.png" alt="image"></p>
<p>注意：这里是repository:更改成你github那个仓库的地址</p>
<p><img src="http://oor0l2hfq.bkt.clouddn.com/71c5686e-f623-4ac1-b9d5-4e153ca6b6b7.png" alt="image"></p>
<p>上述图片已经的样式，里面可以配置关于自己的信息以及其他关键信息，接下俩的重点是主题的配置，打开我们先前下载的Next的<strong>主题配置文件</strong>，如下图<br><img src="http://oor0l2hfq.bkt.clouddn.com/%E5%BD%95%E5%88%B6Gif1.gif" alt="image"></p>
<p>在主题配置文件可以设置各种信息！可以编辑这个文件进行各种设置，配出你喜欢的博客界面</p>
<h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><h3 id="如何写博客"><a href="#如何写博客" class="headerlink" title="如何写博客"></a>如何写博客</h3><p>我博客是准备用Markdown来写，但是如何在Hexo里面如何写呢？这就需要用Hexo-admin这个插件<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install --save hexo-admin hexo server -d</div></pre></td></tr></table></figure></p>
<p>完成后就可以在浏览器输入：<code>http://localhost:4000/admin</code>进行在写书写博客了 但是需要注意的是这里需要你申请账号和密码，在<strong>主站的配置文件</strong>加入下面几行代码,自己写上<strong>name</strong>和<strong>password</strong>，这个在你登录 <strong><a href="http://localhost:4000/admin" target="_blank" rel="external">http://localhost:4000/admin</a></strong> 需要用到的</p>
<p><img src="http://oor0l2hfq.bkt.clouddn.com/016cdcdb-e2dd-4e9e-98c4-ff60f4effed0.png" alt="image"></p>
<h3 id="Markdown语言"><a href="#Markdown语言" class="headerlink" title="Markdown语言"></a>Markdown语言</h3><h4 id="标题"><a href="#标题" class="headerlink" title="标题"></a>标题</h4><p><strong>“# 标题”</strong> 表示一级标题<br><strong>“## 标题”</strong>表示二级标题<br>以此类推 <strong>“###### 标题”</strong>表示六级标题</p>
<p>注意：”#”和【标题】之间建议保留一个字符的空格，这是标准的Markdown写法</p>
<h4 id="列表"><a href="#列表" class="headerlink" title="列表"></a>列表</h4><p>列表有两种表达形式 <strong> - </strong> 和 <strong>1.</strong>来表示，例如<br>“- 文本1”<br>“- 文本2”<br>“1. 文本1”<br>“2. 文本2”</p>
<h4 id="链接和图片"><a href="#链接和图片" class="headerlink" title="链接和图片"></a>链接和图片</h4><p>“[链接显示的文字] (网址)” 这种格式显示的是链接的语法<br>“! [image] (图片Url)”这种格式显示的是图片的语法</p>
<h4 id="引用"><a href="#引用" class="headerlink" title="引用"></a>引用</h4><p>“&gt;” 表示一级引用<br>“&gt; &gt;”表示二级引用<br>“&gt;&gt;&gt;”表示三级引用</p>
<h4 id="粗体和斜体"><a href="#粗体和斜体" class="headerlink" title="粗体和斜体"></a>粗体和斜体</h4><p>Markdown的粗体和斜体很简单，粗体用 两个 星号包含一段文字  ，<br>斜体用 * 包含一段文字就好,</p>
<h4 id="代码引用"><a href="#代码引用" class="headerlink" title="代码引用"></a>代码引用</h4><p>需要引用 “```”包含代码块就好了 </p>
<h2 id="如何往Markdown加载本地图片"><a href="#如何往Markdown加载本地图片" class="headerlink" title="如何往Markdown加载本地图片"></a>如何往Markdown加载本地图片</h2><p>可以通过<a href="https://portal.qiniu.com" target="_blank" rel="external">七牛</a>,进行图片处理得到图片的Url往博客里面插入</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/其它/" rel="tag"># 其它</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/06/28/OC常用方法/" rel="next" title="OC常用方法">
                <i class="fa fa-chevron-left"></i> OC常用方法
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/04/19/hello-world/" rel="prev" title="Hello World">
                Hello World <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/images/avatar.jpg"
               alt="刘志伟" />
          <p class="site-author-name" itemprop="name">刘志伟</p>
           
              <p class="site-description motion-element" itemprop="description">人间正道是沧桑</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">4</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">2</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">2</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#前言"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#搭建博客的准备"><span class="nav-number">2.</span> <span class="nav-text">搭建博客的准备</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#搭建博客工具"><span class="nav-number">2.1.</span> <span class="nav-text">搭建博客工具</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Hexo的主题"><span class="nav-number">2.2.</span> <span class="nav-text">Hexo的主题</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#其他"><span class="nav-number">3.</span> <span class="nav-text">其他</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#如何写博客"><span class="nav-number">3.1.</span> <span class="nav-text">如何写博客</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Markdown语言"><span class="nav-number">3.2.</span> <span class="nav-text">Markdown语言</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#标题"><span class="nav-number">3.2.1.</span> <span class="nav-text">标题</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#列表"><span class="nav-number">3.2.2.</span> <span class="nav-text">列表</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#链接和图片"><span class="nav-number">3.2.3.</span> <span class="nav-text">链接和图片</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#引用"><span class="nav-number">3.2.4.</span> <span class="nav-text">引用</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#粗体和斜体"><span class="nav-number">3.2.5.</span> <span class="nav-text">粗体和斜体</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#代码引用"><span class="nav-number">3.2.6.</span> <span class="nav-text">代码引用</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#如何往Markdown加载本地图片"><span class="nav-number">4.</span> <span class="nav-text">如何往Markdown加载本地图片</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">刘志伟</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  





  





  






  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
      search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.popup').toggle();
    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';
      $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = $( "entry", xmlResponse ).map(function() {
            return {
              title: $( "title", this ).text(),
              content: $("content",this).text(),
              url: $( "url" , this).text()
            };
          }).get();
          var $input = document.getElementById(search_id);
          var $resultContent = document.getElementById(content_id);
          $input.addEventListener('input', function(){
            var matchcounts = 0;
            var str='<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length > 1) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var content_index = [];
                var data_title = data.title.trim().toLowerCase();
                var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                var data_url = decodeURIComponent(data.url);
                var index_title = -1;
                var index_content = -1;
                var first_occur = -1;
                // only match artiles with not empty titles and contents
                if(data_title != '') {
                  keywords.forEach(function(keyword, i) {
                    index_title = data_title.indexOf(keyword);
                    index_content = data_content.indexOf(keyword);
                    if( index_title >= 0 || index_content >= 0 ){
                      isMatch = true;
                      if (i == 0) {
                        first_occur = index_content;
                      }
                    }

                  });
                }
                // show search results
                if (isMatch) {
                  matchcounts += 1;
                  str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                  var content = data.content.trim().replace(/<[^>]+>/g,"");
                  if (first_occur >= 0) {
                    // cut out 100 characters
                    var start = first_occur - 20;
                    var end = first_occur + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if(start == 0){
                      end = 50;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    var match_content = content.substring(start, end);
                    // highlight all keywords
                    keywords.forEach(function(keyword){
                      var regS = new RegExp(keyword, "gi");
                      match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                    });

                    str += "<p class=\"search-result\">" + match_content +"...</p>"
                  }
                  str += "</li>";
                }
              })};
            str += "</ul>";
            if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
            if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
            $resultContent.innerHTML = str;
          });
          proceedsearch();
        }
      });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>





  

  

  

  

  

</body>
</html>
